package jeesample.dtos;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import jeesample.model.Room;

@XmlRootElement(name = "RoomDTO")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RoomDTO", propOrder = { "roomId", "location", "name",
		"comments" })
public final class RoomDTO extends DataTransferObject {
	private static final long serialVersionUID = 1L;

	@XmlElement(required = true)
	private String name;
	@XmlElement(required = true)
	private String location;
	@XmlElement(required = true)
	private String roomId;
	@XmlElement(required = true)
	private String comments;

	@Override
	public DataTransferObject getChildDTO() {
		return this;
	}

	public RoomDTO() {
	}

	public RoomDTO(Room model) {
		name = model.getName();
		location = model.getLocation();
		roomId = model.getRoomId();
		comments = model.getComments();
	}

	public Room getModel() {
		Room model = new Room();
		model.setName(name);
		model.setLocation(location);
		model.setRoomId(roomId);
		model.setComments(comments);
		return model;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getLocation() {
		return location;
	}

	public void setLocation(String location) {
		this.location = location;
	}

	public String getRoomId() {
		return roomId;
	}

	public void setRoomId(String roomId) {
		this.roomId = roomId;
	}

	public String getComments() {
		return comments;
	}

	public void setComments(String comments) {
		this.comments = comments;
	}

}